package
{
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	
	/**
	 * ...
	 * @author 
	 */
	import flash.events.*;
	
	public class Crab extends MovieClip
	{
		
		var Angle:int = 90;
		
		var MC_Leg:DisplayObject;
		
		private var  5
		
		
		public function Crab() 
		{
			
			
			this.addEventListener(Event.ADDED_TO_STAGE, onATS);
		}
		
		private function onATS(e:Event) {
			
			this.removeEventListener(Event.ADDED_TO_STAGE, onATS);
			
			stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
			
			this.addEventListener(Event.ENTER_FRAME, onEF);
			
			
			MC_Leg = getChildByName("Leg");
			
		}
		private function onEF(e:Event):void {
			
			
			MC_Leg.rotation = Angle;
			
		}
		
		private function onKeyDown(e:KeyboardEvent):void {
			trace("Angle", Angle);
			
			switch(e.keyCode) {
				case 37:	//Left
				Angle -= 5;
				
				break;
				case 39:	//Right
				Angle += 5;
			
				
				break;
			}
			
		}
		
		
		
	}

}